import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";
import pluginReactConfig from "eslint-plugin-react/configs/recommended.js";
import { fixupConfigRules } from "@eslint/compat";

export default [
  { languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } } },
  { languageOptions: { globals: globals.browser } },
  pluginJs.configs.recommended,
  ...tseslint.configs.recommended,
  ...fixupConfigRules(pluginReactConfig),
  {
    ignores: ["node_modules/", "build", "dist"],
    // extends: ["prettier"],
  },
  {
    // files: ["src/**/*.{js,mjs,cjs,ts,jsx,tsx}"],
    // 这个settings是为了解决报错后加的
    settings: {
      react: {
        version: "detect", // 自动检测 React 版本
      },
    },
    rules: {
      "@typescript-eslint/no-unused-vars": "off",
    },
  },
];
